stage.set_background("winter")
sprite = codesters.Sprite("fox")
sprite.move_down(150)
stage.wait(2)
sprite.move_right(50)
def click(sprite):
sprite.say("Hello, name")
sprite.event_click(click)
t = codesters.Teacher()
try:
params = t.find_function('say')
tval1 = int(params[0][0])
tval1a = t.get_indent_at_line(tval1)
tval1b = params[0][1]
except:
tval1 = "DNE"
tval1a = "DNE"
params = "DNE"
tval1b = params[0][1]
t1 = TestObjective()
t1.add_failure("Hello, name" in tval1b, "Did you change the sprite's say command?")
t1.add_failure(tval1 == "DNE", "Did you delete the say command?")
t1.add_failure(tval1a == 0, "Did you unindent your say command?")
t1.add_failure(tval1a > 4, "I think you indented the say command too much.")
t1.add_success("Hello, name" not in tval1b and tval1 != "DNE" and tval1a == 4, "Great Job! Be sure to click on your sprite!")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)